<form id="<?php echo $uniqid;?>">
    <div id="orderManage" class="easyui-panel" title="订单管理">
        <div class="datagrid-toolbar" style="padding:5px;border-bottom:#eee 1px solid;">
            <table cellspacing="0" cellpadding="0">
                <tbody>
                <tr>
                    <td colspan="3" style="padding-bottom: 3px;">
                        <a href="javascript:void(0);" @click="init();" class="l-btn l-btn-small l-btn-plain"><span
                                class="l-btn-left l-btn-icon-left"><i class="iconfont icon-shuaxin"></i><span
                                class="l-btn-text">重载</span></span></a>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='all'?'selected':''"
                              @click="filter('all')"><span class="l-btn-text">全部</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='canceled'?'selected':''"
                              @click="filter('canceled')"><span class="l-btn-text">已取消</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='closed'?'selected':''"
                              @click="filter('closed')"><span class="l-btn-text">交易关闭</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='nopay'?'selected':''"
                              @click="filter('nopay')"><span class="l-btn-text">待付款</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='paid'?'selected':''"
                              @click="filter('paid')"><span class="l-btn-text">已支付</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='nosend'?'selected':''"
                              @click="filter('nosend')"><span class="l-btn-text">待发货</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='send'?'selected':''"
                              @click="filter('send')"><span class="l-btn-text">已发货</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='nocomment'?'selected':''"
                              @click="filter('nocomment')"><span class="l-btn-text">待评价</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='finished'?'selected':''"
                              @click="filter('finished')"><span class="l-btn-text">已完成</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='aftersale'?'selected':''"
                              @click="filter('aftersale')"><span class="l-btn-text">售后</span></span>
                        <span class="l-btn l-btn-small l-btn-plain" :class="params.mode=='refund'?'selected':''"
                              @click="filter('refund')"><span class="l-btn-text">退款</span></span>
                    </td>
                </tr>
                <tr>
                    <td><span style="line-height:30px;">订单日期</span>
                        <input id="orderStartOn" v-model="params.start_on" style="width:152px" type="text"
                               class="easyui-datetimebox"> </input>至
                        <input id="orderEndOn" v-model="params.end_on" style="width:152px" type="text"
                               class="easyui-datetimebox"> </input>
                    </td>
                    <td>&nbsp;<select v-model="params.payType" @change="init" class="forminput inputstyle textbox-text validatebox-text" style="width:110px">
                        <option value="">全部支付方式</option>
                        <option value="wallet">钱包支付</option>
                        <option value="wechat">微信支付</option>
                        <option value="pickgoods">提货卡</option>
                        <option value="alipay">支付宝支付</option>
                        <option value="JoinPay">汇聚支付</option>
                        </select>
                    </td>
                    <td>&nbsp;<select v-model="params.keywordsType" class="forminput inputstyle textbox-text validatebox-text" style="width:80px">
                        <option value="order_id">订单ID</option>
                        <option value="order_sn">订单编号</option>
                        <option value="member_id">会员ID</option>
                        <option value="member_phone">会员手机号</option>
                        <option value="customer_id">代客下单ID</option>
                        <option value="consignee">收货人</option>
                        <option value="consignee_phone">收货人手机号</option>
                    </select>&nbsp;<input v-model="params.keywords" placeholder="请输入内容" @keyup.enter="search"
                                           class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                           type="text"> </input>
                    </td>
                    <td>商品&nbsp;<input v-model="params.goods" @keyup.enter="search"
                                           class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                           type="text" placeholder="请输入商品名称或商品ID"> </input>
                    </td>
                    <td><a href="javascript:void(0);" @click="search" class="l-btn l-btn-small l-btn-plain"><span
                            class="l-btn-left l-btn-icon-left"><i class="iconfont icon-sousuo"></i><span
                            class="l-btn-text">查询</span></span></a></td>
                    <td v-if="params.mode=='nosend'"><a href="javascript:void(0);" @click="exportNosend" class="l-btn l-btn-small l-btn-plain"><span
                            class="l-btn-left l-btn-icon-left"><i class="iconfont icon-xiazai"></i><span
                            class="l-btn-text">导出发货单</span></span></a>
                        <a href="javascript:void(0);" @click="batchSend" class="l-btn l-btn-small l-btn-plain"><span
                                class="l-btn-left l-btn-icon-left"><i class="iconfont icon-wangzhan"></i><span
                                class="l-btn-text">批量发货</span></span></a></td>
<!--                    <td v-else><a href="javascript:void(0);" @click="exportExcel" class="l-btn l-btn-small l-btn-plain"><span-->
<!--                            class="l-btn-left l-btn-icon-left"><i class="iconfont icon-xiazai"></i><span-->
<!--                            class="l-btn-text">导出订单</span></span></a></td>-->
                </tr>
                </tbody>
            </table>
        </div>
        <div class="con" style="-moz-user-select:none;overflow: hidden;padding-bottom: 50px;">
            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                   style="width: 100%;border: #ccc 0 solid;border-collapse:collapse;">
                <thead>
                <tr class="datagrid-header-row" style="background-color: #f9f9f9; font-weight: 550;">
                    <td width="35%" style="padding:0; border-bottom:#eee 1px solid;">商品信息</td>
                    <td width="5%" style="border-bottom:#eee 1px solid;">发货状态</td>
                    <td width="5%" style="border-bottom:#eee 1px solid;">退款状态</td>
                    <td width="5%" style="border-bottom:#eee 1px solid;">售后状态</td>
                    <td width="5%" style="border-bottom:#eee 1px solid;">订单状态</td>
                    <td width="10%" style="border-bottom:#eee 1px solid;">下单用户</td>
                    <td width="7%" style="border-bottom:#eee 1px solid;">收件信息</td>
                    <td width="5%" style="border-bottom:#eee 1px solid;padding: 5px;">配送方式</td>
                    <td width="10%" style="border-bottom:#eee 1px solid;padding: 5px;">支付信息</td>
                    <td width="7%" style="border-bottom:#eee 1px solid;padding: 5px; text-align: center;">操作</td>
                </tr>
                </thead>
                <tbody>
                <template v-for="(vo,index) in dataset">
                    <tr class="datagrid-header-row">
                        <td colspan="10" style="background: #f9f9f9;">
                            <div style="display: flex; justify-content: space-between;">
                                <div style="height: 36px;padding-left:10px;line-height: 36px;">
                                    ID：{{ vo.id }}
                                    订单号：{{ vo.order_sn }}
                                    平台：{{ vo.platform | platform }}
                                    - <span style="color: #0b6bc2">{{ vo.type | type }}</span>
                                    支付方式：
                                        <span v-if="vo.pay_type" style="color: #0b6bc2">{{vo.pay_type_text}}</span>
                                        <span v-else style="color: #ff6060">未支付</span>
                                    <span v-if="vo.is_first==1" style="color: #ff6060">(首.单)</span>
                                    <span v-if="vo.combo_goods_id" style="margin-left: 20px">套餐ID:<span style="color: #206bdd">{{vo.combo_goods_id}}</span></span>
                                    <span v-if="vo.combo_goods_title" style="margin-left: 20px">套餐名称: <span style="color: #206bdd">{{vo.combo_goods_title}}</span></span>
                                </div>
                                <div style="text-align: right;padding-right: 30px; height: 36px;line-height: 36px;">
                                    下单时间：{{ vo.created_at }}
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr class="datagrid-header-row" @dblclick="orderView(vo.id)">
                        <td width="35%" style="padding:0; border:#eee 1px solid;border-bottom: none;" v-if="vo.item">
                            <template v-for="(vo1, index1) in vo.item">
                                <div class="order-item-rows">
                                    <div style="display: flex;align-items:Center;justify-content: space-between;">
                                        <div style="text-align: center;overflow:hidden;"><img :src="vo1.goods_image"
                                                                                              height="60px"/></div>
                                        <div style="line-height: 24px; padding: 2px;">
                                            <p>{{vo1.goods_title}} </p>
                                            <p>商品ID：{{vo1.goods_id}} 单价：{{vo1.goods_price}}元 数量：{{vo1.goods_num}}
                                                <span v-if="vo1.goods_sku_text">规格：{{vo1.goods_sku_text}}</span></p>
                                        </div>
                                    </div>
                                </div>
                            </template>
                        </td>
                        <td width="5%" style="border:#eee 1px solid;">
                            <div class="order-item-rows order-item-center" v-for="(vo1, index1) in vo.item">
                                <p style="line-height: 28px; color: #0b6bc2; cursor: pointer;"
                                   v-if="vo1.status_code=='nosend' && vo1.dispatch_status==0 && vo1.dispatch_type=='express'"
                                   @click="openDeliverDialog(vo.id)">立即发货</p>
                                <p style="line-height: 28px;" v-else>{{ vo1.dispatch_status | dispatch }}</p>
                            </div>
                        </td>
                        <td width="5%" style="border:#eee 1px solid;">
                            <div class="order-item-rows order-item-center" v-for="(vo1, index1) in vo.item">
                                <p style="line-height: 28px;">{{ vo1.refund_status | refund }}</p>
                            </div>
                        </td>
                        <td width="5%" style="border:#eee 1px solid;">
                            <div class="order-item-rows order-item-center" v-for="(vo1, index1) in vo.item">
                                <p style="line-height: 28px;">{{ vo1.aftersale_status | aftersale }}</p>
                            </div>
                        </td>
                        <td width="5%" style="border:#eee 1px solid;text-align: center">
                            <p style="line-height: 28px;" v-if="vo.status>=0">{{ vo.status_name }}</p>
                            <p style="line-height: 28px;color:#999;" v-else>{{ vo.status_name }}</p>
                        </td>
                        <td width="10%" style="border:#eee 1px solid;">
                            <div style="display: flex;flex-direction:column;justify-content: center;align-items: center">
                                <div style="text-align: center;overflow:hidden;" v-if="vo.customer_id>0">
                                    <p style="color: red">代客下单</p>
                                    <p style="line-height: 25px;text-align: center;color: red">支付人ID：{{ vo.member_id }}</p>
                                    <p style="line-height: 25px;text-align: center">下单人ID：{{ vo.customer_id }}</p>
                                    <p style="line-height: 25px;text-align: center">{{ vo.customer && vo.customer.nickname }} - {{ vo.customer && vo.customer.phone }}</p>
                                </div>
                                <div class="easyui-tooltip" v-else>
                                    <p style="line-height: 25px;text-align: center">下单人ID：{{ vo.member_id }}</p>
                                    <p style="line-height: 25px;text-align: center">{{ vo.member && vo.member.nickname }} - {{ vo.member && vo.member.phone }}</p>
                                </div>
                            </div>
                        </td>
                        <td width="7%" style="border:#eee 1px solid; text-align: center">
                            <p style="line-height: 25px;">{{vo.consignee}} </p>
                            <p style="line-height: 25px;">{{vo.phone}}</p>
                        </td>
                        <td width="5%" bgcolor="#fff" style="border:#eee 1px solid;padding: 5px;" align="left">
                            <p style="line-height: 28px;">{{ vo.item[0].dispatch_type | dispatchType }}</p>
                        </td>
                        <td width="10%" bgcolor="#fff" style="border:#eee 1px solid;padding: 5px;" align="left">
                            <div v-if="vo.status>0" style="text-align: center">
                                <p style="line-height: 25px;">{{vo.pay_fee}}元</p>
                                <p style="line-height: 25px;" v-if="vo.score_fee>0">+{{vo.score_fee}}积分</p>
                                <p style="line-height: 25px;" v-if="vo.paytime">{{vo.paytime | formatDate}}</p>
                            </div>
                        </td>
                        <td width="7%" bgcolor="#fff" style="border:#eee 1px solid;padding: 5px; text-align: center;">
                            <span class="l-btn l-btn-small  table" @click="orderView(vo.id)"><span
                                    class="l-btn-text">详细</span></span>
                        </td>
                    </tr>
                </template>
                </tbody>
            </table>
            <div class="datagrid-pager pagination"
                 style="width: 100%;position: fixed;bottom: 0px; background-color: #f1f1f1;padding-top:5px;border-top:#ccc 1px solid;display: flex;">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                    <tr>
                        <td><select class="pagination-page-list">
                            <option>10</option>
                            <option>15</option>
                            <option>20</option>
                            <option>25</option>
                        </select></td>
                        <td>
                            <div class="pagination-btn-separator"></div>
                        </td>
                        <td>
                            <template v-if="params.page==1">
                                <a href="javascript:;" @click="first"
                                   class="l-btn l-btn-small l-btn-plain l-btn-disabled l-btn-plain-disabled"
                                ><span class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-first">&nbsp;</span></span></a>
                            </template>
                            <template v-else>
                                <a href="javascript:;" @click="first"
                                   class="l-btn l-btn-small l-btn-plain"
                                ><span class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-first">&nbsp;</span></span></a>
                            </template>
                        </td>
                        <td>
                            <template v-if="params.page==1">
                                <a href="javascript:;" @click="pre"
                                   class="l-btn l-btn-small l-btn-plain l-btn-disabled l-btn-plain-disabled"
                                ><span class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-prev">&nbsp;</span></span></a>
                            </template>
                            <template v-else>
                                <a href="javascript:;" @click="pre"
                                   class="l-btn l-btn-small l-btn-plain"
                                ><span class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-prev">&nbsp;</span></span></a>
                            </template>
                        </td>
                        <td>
                            <div class="pagination-btn-separator"></div>
                        </td>
                        <td><span style="padding-left:6px;">第</span></td>
                        <td><input class="pagination-num" type="text" v-model="params.page" size="2" @keyup.enter="init"></td>
                        <td><span style="padding-right:6px;">共{{totalPage}}页</span></td>
                        <td>
                            <div class="pagination-btn-separator"></div>
                        </td>
                        <td>
                            <template v-if="params.page==totalPage">
                                <a href="javascript:;" @click="next"
                                   class="l-btn l-btn-small l-btn-plain l-btn-disabled l-btn-plain-disabled"><span
                                        class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-next">&nbsp;</span></span></a>
                            </template>
                            <template v-else>
                                <a href="javascript:;" @click="next" class="l-btn l-btn-small l-btn-plain"><span
                                        class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-next">&nbsp;</span></span></a>
                            </template>
                        </td>
                        <td>
                            <template v-if="params.page==totalPage">
                                <a href="javascript:;" @click="last"
                                   class="l-btn l-btn-small l-btn-plain l-btn-disabled l-btn-plain-disabled"><span
                                        class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-last">&nbsp;</span></span></a>
                            </template>
                            <template v-else>
                                <a href="javascript:;" @click="last" class="l-btn l-btn-small l-btn-plain"><span
                                        class="l-btn-left l-btn-icon-left"><span
                                        class="l-btn-text l-btn-empty">&nbsp;</span><span
                                        class="l-btn-icon pagination-last">&nbsp;</span></span></a>
                            </template>
                        </td>
                        <td>
                            <div class="pagination-btn-separator"></div>
                        </td>
                        <td><a href="javascript:;" @click="init" class="l-btn l-btn-small l-btn-plain"><span
                                class="l-btn-left l-btn-icon-left"><span
                                class="l-btn-text l-btn-empty">&nbsp;</span><span
                                class="l-btn-icon pagination-load">&nbsp;</span></span></a></td>
                    </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示{{(params.page-1) * params.rows + 1}}到{{params.page * params.rows}},共{{total}}记录</div>
            </div>
        </div>
    </div>
</form>
<div id="orderdeliverydlg" class="easyui-dialog" style="width:840px; height:520px;" title="信息框" closed="true"></div>

<script>
    var orderVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            dataset: [],
            params: {
                sort: 'created_at',
                order: 'desc',
                rows: 10,
                page: 1,
                status: 0,
                start_on: '',
                end_on: '',
                keywords: '',
                keywordsType:'order_id',
                goods: '',
                mode: 'all',
                payType: '',
            },
            total: 0,
            totalPage: 0,
        },
        watch: {
            params: {
                handler(n, o){
                    this.params.page = this.params.page<1 ? 1 : this.params.page;
                },
                deep: true
            }
        },
        filters: {
            dispatch(value) {
                // 0=未发货,1=已发货,2=已收货
                switch (parseInt(value)) {
                    case 0:
                        return '未发货';
                    case 1:
                        return '已发货';
                    case 2:
                        return '已收货';
                }
            },
            aftersale(value) {
                // -1=拒绝,0=未申请,1=申请售后,2=售后完成
                switch (parseInt(value)) {
                    case -1:
                        return '拒绝';
                    case 0:
                        return '未申请';
                    case 1:
                        return '申请售后';
                    case 2:
                        return '售后完成';
                }
            },
            refund(value) {
                // -1=拒绝退款,0=无,1=申请中,2=同意
                switch (parseInt(value)) {
                    case -1:
                        return '拒绝退款';
                    case 0:
                        return '无';
                    case 1:
                        return '申请中';
                    case 2:
                        return '同意';
                    case 3:
                        return '退款完成';
                }
            },
            dispatchType(value){
                // express=物流快递,selfetch=用户自提,store=商户配送,autosend=自动发货
                switch (value) {
                    case 'express':
                        return '物流快递';
                    case 'selfetch':
                        return '用户自提';
                    case 'store':
                        return '商户配送';
                    case 'autosend':
                        return '自动发货';
                }
            },
            platform(value){
                // H5=H5,wxOfficialAccount=微信公众号,wxMiniProgram=微信小程序,App=App
                switch (value) {
                    case 'H5':
                    case 'App':
                        return value;
                    case 'wxOfficialAccount':
                        return '微信公众号';
                    case 'wxMiniProgram':
                        return '微信小程序';
                }
            },
            type(value){
                switch (value) {
                    case 'goods':
                        return '商城订单';
                    case 'score':
                        return '积分订单';
                }
            },
            payType(value){
                // wechat=微信支付,alipay=支付宝,wallet=钱包支付,score=积分支付
                switch (value) {
                    case 'wechat':
                        return '微信支付';
                    case 'alipay':
                        return '支付宝';
                    case 'wallet':
                        return '钱包支付';
                    case 'score':
                        return '积分支付';
                    case 'JoinPay-wx':
                        return '汇聚支付-微信';
                    case 'JoinPay-ali':
                        return '汇聚支付-支付宝';
                    case 'pickgoods':
                        return '提货卡';
                    default:
                        return '未支付';
                }
            },
            formatDate(nS){
                return new Date(parseInt(nS) * 1000).toLocaleString().replace(/:\d{1,2}$/,' ');
            }
        },
        mounted() {
            this.params.start_on = moment((new Date()).getTime() - 86400 * 3 * 1000).format("Y-MM-DD 00:00:00");
            this.params.end_on = moment().format("Y-MM-DD 23:59:59");
            setTimeout(()=>{
                $('#<?php echo $uniqid;?> #orderStartOn').datetimebox('setValue', this.params.start_on);
                $('#<?php echo $uniqid;?> #orderEndOn').datetimebox('setValue', this.params.end_on);
                this.init();
            }, 200);
        },
        methods: {
            init: function () {
                $('#<?php echo $uniqid;?> .pagination').width($(window).width() - $("#leftMenu").width() - 30);
                showLoading('#<?php echo $uniqid;?>');
                this.params.start_on = $('#<?php echo $uniqid;?> #orderStartOn').datetimebox('getValue');
                this.params.end_on = $('#<?php echo $uniqid;?> #orderEndOn').datetimebox('getValue');
                $.post('/merchant/order/index', this.params, (data) => {
                    hideLoading();
                    this.dataset = data.rows;
                    this.total = data.total;
                    this.totalPage = Math.ceil(data.total / this.params.rows);
                }, 'json');
            },
            search(){
                orderVm.params.page = 1;
                orderVm.init();
            },
            exportNosend() {
                showLoading('.con');
                this.params.start_on = $('#<?php echo $uniqid;?> #orderStartOn').datetimebox('getValue');
                this.params.end_on = $('#<?php echo $uniqid;?> #orderEndOn').datetimebox('getValue');
                $.post('/merchant/order/exportnosend', this.params, function (data) {
                    hideLoading();
                    if (parseInt(data.ret) === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        eventmaterialDownload(data.data);
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json').fail((response)=> {
                    hideLoading();
                    $.messager.alert('提示', response.responseText, 'warning');
                });
            },
            batchSend() {
                $("#orderdeliverydlg").dialog({
                    title: '订单发货',
                    closed: false,
                    width: 740,
                    height: 420,
                    cache: false,
                    href: '/merchant/order/batchSend',
                    modal: true,
                    buttons: [{
                        text: '立即发货',
                        id: 'orderdeliverysubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            },
            filter(mode) {
                this.params.mode = mode;
                this.init();
            },
            first: function () {
                orderVm.params.page = 1;
                orderVm.init();
            },
            pre: function () {
                if (orderVm.params.page > 1) {
                    orderVm.params.page--;
                    orderVm.init();
                }
            },
            next: function () {
                if (orderVm.params.page < orderVm.totalPage) {
                    orderVm.params.page++;
                    orderVm.init();
                }
            },
            last: function () {
                orderVm.params.page = orderVm.totalPage;
                orderVm.init();
            },
            orderexport: function () {},
            orderView: function (id) {
                $('#rightTabs').tabs('close', '查看订单');
                addTab('查看订单', '/merchant/order/edit?id=' + id);
            },
            orderdelete: function () {
                var row = $('#order').datagrid('getSelected');
                if (row) {
                    $.messager.confirm('提示', '确定删除吗？', function (r) {
                        if (r) {
                            $.messager.progress();
                            $.post('/merchant/order/orderdelete', {id: row.id}, function (data) {
                                $.messager.progress('close');
                                if (data.ret == 0) {
                                    $.messager.show({
                                        title: '提示',
                                        msg: data.msg,
                                        timeout: 3000,
                                        showType: 'slide'
                                    });
                                    orderreload();
                                } else {
                                    $.messager.alert('提示', data.msg, 'warning');
                                }
                            }, 'json');
                        }
                    });
                } else {
                    $.messager.alert('提示', '请先选择要操作的行！', 'warning');
                }
            },
            orderreload: function () {
                $("#order").datagrid('reload');
            },
            openDeliverDialog(order_id) {
                $("#orderdeliverydlg").dialog({
                    title: '订单发货',
                    closed: false,
                    width: 740,
                    height: 520,
                    cache: false,
                    href: '/merchant/order/delivery?order_id=' + order_id,
                    modal: true,
                    buttons: [{
                        text: '立即发货',
                        id: 'orderdeliverysubmit',
                        iconCls: 'icon-ok',
                    }, {
                        text: '关闭',
                        iconCls: 'icon-no',
                        handler: function () {
                            $("#orderdeliverydlg").dialog('close');
                        }
                    }]
                });
            },
            exportExcel(){
                showLoading('.con');
                this.params.start_on = $('#<?php echo $uniqid;?> #orderStartOn').datetimebox('getValue');
                this.params.end_on = $('#<?php echo $uniqid;?> #orderEndOn').datetimebox('getValue');
                $.post('/merchant/order/export', this.params, function (data) {
                    hideLoading();
                    if (parseInt(data.ret) === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        eventmaterialDownload(data.data);
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json').fail((response)=> {
                    hideLoading();
                    $.messager.alert('提示', response.responseText, 'warning');
                });
            },
        }
    });

    document.addEventListener('onResize', (e) => {
        let height = $(window).height() - $(".top").height() - 46;
        $('#orderManage').panel('resize', {width: 'auto', height: 'auto'});
    });
</script>

<style>
    .l-btn-plain{
        border: rgba(0,0,0,0) 1px solid;
    }
    .order-item-rows {
        padding: 4px;
        display: flex;
        min-height: 90px;
        justify-content: space-between;
        align-items: center;
        border-bottom: #eee 1px solid;
    }
    .order-item-center{
        justify-content: center;
        text-align: center;
    }

    .datagrid-toolbar .selected {
        color: #f1f1f1;
        background: #1065a7;
        border: 1px solid #f0f0f0;
    }
</style>